class Solution(object):
    def maxAbsValExpr(self, arr1, arr2):
        n = len(arr1)
        min_A = float('inf')
        min_B = float('inf')
        min_C = float('inf')
        min_D = float('inf')
        max_A = -float('inf')
        max_B = -float('inf')
        max_C = -float('inf')
        max_D = -float('inf')
        for i in range(n):
            min_A = min(min_A, arr1[i] + arr2[i] + i)
            max_A = max(max_A, arr1[i] + arr2[i] + i)
            min_B = min(min_B, arr1[i] + arr2[i] - i)
            max_B = max(max_B, arr1[i] + arr2[i] - i)
            min_C = min(min_C, arr1[i] - arr2[i] + i)
            max_C = max(max_C, arr1[i] - arr2[i] + i)
            min_D = min(min_D, arr1[i] - arr2[i] - i)
            max_D = max(max_D, arr1[i] - arr2[i] - i)
        return max(max_A - min_A, max_B - min_B, max_C - min_C, max_D - min_D)